<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
.STYLE1 {font-size: 24px}
.STYLE2 {font-size: 70px}
.STYLE7 {font-size: smaller}
.STYLE6 {font-size: medium}
-->
</style>
 	
	<!-- start about us -->
		<?php
		
		//初始化模板参数:$this->aboutusTitle、$this->aboutusTitleImg
		
		$this->aboutusTitle = '四川大学网上第二课堂的
		资料下载旨在
		为师生之间资源共享提供一个直接的平台，
		在这里，你可以按照科目和老师选择你需要的课件，
		也可以上传资料';
		$this->aboutusTitleImg = $this->baseUrl().'/images/downloadTitleImg.jpg';
		
		$aboutusLayout = new Zend_Layout();
		echo $aboutusLayout->render('/module/aboutus');
		?>
	<!-- end about us -->
	
	<!-- start logos -->
	<div class="logos">
		
	</div>
	<!-- end logos -->
	
	<!-- start content -->
	<div id="vg-content">

		<!-- start portfolio details -->
		<div id="portfolio-details" class="vg-page">
		
			<!-- start details -->
			<?php
				//左侧信息
				$this->fromhref = '?fromhref=/download/index';
				if($this->isloggin==true)
				{
				    $userinfoLayout = new Zend_Layout();
				    echo $userinfoLayout->render('/module/userinfo');
				}
				else 
				{
				    //左侧登录
					$loginLayout = new Zend_Layout();
					echo $loginLayout->render('/module/login');
				}
			?>
			<article class="border-top c-four height-auto">
				<div class="vg-item-article vg-portfolio-details">
					<!-- title -->
					<form id="searchform" name="searchform" action="<?php echo $this->baseUrl().'/download/search'?>" method="post">
					<h1 class="STYLE6">搜索你想要的资源
					  <label>
						  <input type="text" id="searchbox" name="searchbox" onkeypress="searchEnter()">
					  <br>
					  <br>
					  </label>
					</h1>
					</form>
					<!-- end title -->
					<!-- upload start -->
					<form id="uploadform" name="uploadform" enctype="multipart/form-data" action="<?php echo $this->baseUrl().'/download/upload'?>"method="post">
					
					<div class="upload" onclick="$('#selectfile').hide();">
						<input type="file" id="selectfile" name="selectfile"/>
						<button id="uploadfile" name="uploadfile">上传文件</button></div>
			        </form>	
					<!-- upload ends -->
					
					<?php
						
						if(isset($this->isSearchMode)&&$this->isSearchMode&&isset($this->searchTips))
						{
							echo '<h3 class="searchTips">'.$this->searchTips.'</h3>';
						}
					?>
					
					<!-- download list -->
					<ul class="downloadul">
					<?php
					//print_r($this->files);
					if(count($this->allfiles)==0)
					{
						echo '没有任何资源';
					}
					
					foreach($this->allfiles as $file)
					{
					    //print_r($file);
					    $href = $this->baseUrl().'/download/download?fileid='.$file['id'];
					    echo "<li><a href=$href>";
					    echo $file['filename'];
					    echo "</a><div class=\"date\">[";
					    echo $file['uploader'];
					    echo "][";
					    $date = new Zend_Date();
					    //echo date_default_timezone_get();
					    //date_default_timezone_set('Asia/Shanghai');鏃犵敤
					    //echo date_default_timezone_get();
					    echo gmdate('Y-m-d',$file['filedate']+3600 * 8);
					    echo "]</div></li>";
					} 
					
					?>
				</ul>
					<!-- enddownload list -->
					<!-- pager start -->
					<?php
					//初始化模板参数:$this->pagerUrl
					if(isset($this->isSearchMode)&&$this->isSearchMode)
					{
					 	;//搜索的时候不分页   
					}
					else 
					{
					    $this->pagerUrl = $this->baseUrl().'/download/index';
					    $aboutusLayout = new Zend_Layout();
					    echo $aboutusLayout->render('/module/pager');
					}
					?>
					<!-- pager end -->
			  </div>
				
			</article>
			<!-- end details -->
			
	  </div>
	  <!-- end portfolio details -->
		
	</div>
	<!-- end content -->

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-23864149-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  function searchEnter(){
	if(event.keyCode==13){
		document.getElementById('searchform').submit();
		return false;
	}  
  }
</script>